package cn.geminis.warehouse.service.purchase.entity;

import cn.geminis.lowcode.annotation.*;
import cn.geminis.warehouse.service.basic.entity.ProductBatch;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.ManyToOne;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;


/**
 * 入库单明细
 */
@Getter
@Setter
@UuidEntity
@QueryFilter
@CrudRepository
@CrudController
public class PurchaseDetail {

    /**
     * 入库单
     */
    @ManyToOne(cascade = {CascadeType.ALL}, optional = false)
    @JsonIgnoreProperties
    @QueryFilterProperty(fieldName = "purchase.id", propertyName = "purchaseId", propertyType = "String")
    private Purchase purchase;

    /**
     * 商品批次
     */
    @ManyToOne(optional = false)
    @QueryFilterProperty(fieldName = "productBatch.id", propertyName = "productBatchId", propertyType = "String")
    @QueryFilterProperty(fieldName = "productBatch.product.id", propertyName = "productBatchProductId", propertyType = "String")
    @QueryFilterProperty(fieldName = "productBatch.product.no", propertyName = "productBatchProductNo", propertyType = "String")
    private ProductBatch productBatch;

    /**
     * 商品价格
     */
    @Column(nullable = false)
    private BigDecimal price;

    /**
     * 商品价格
     */
    @Column(nullable = false)
    private BigDecimal priceLoad;

    /**
     * 商品数量
     */
    @Column(nullable = false)
    private int amount;

    /**
     * 入库扫描数量
     */
    @Column(nullable = false)
    private int amountScan;

    /**
     * 验收数量
     */
    @Column(nullable = false)
    private int amountCheck;

//    /**
//     * 货架
//     */
//    @ManyToOne
//    private Shelf shelf;
//
//    /**
//     * 货架行
//     */
//    @Column
//    private int positionX;
//
//    /**
//     * 货架列
//     */
//    @Column
//    private int positionY;
//
//    /**
//     * 货架层
//     */
//    @Column
//    private int positionZ;
//
//    /**
//     * 上架人
//     */
//    @Column(nullable = false)
//    private String username;
//
//    /**
//     * 上架时间
//     */
//    @Column(nullable = false)
//    private LocalDateTime time;


}
